﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib"
                    xmlns:wpfExtended="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
                    xmlns:converters="clr-namespace:BaMusaSoft.RPS.View.Converters" xmlns:p="clr-namespace:BaMusaSoft.RPS.View.Properties">
  <converters:MaskLiteralsConverter x:Key="LiteralConverter"/>
  <converters:MaskDateConverter x:Shared="False" x:Key="DateConverter"/>
  <converters:OutboxNoConverter x:Shared="False" x:Key="OutboxConverter"/>
  <converters:DateMaskConveter x:Shared="False" x:Key="MaskConverter"/>
  <SolidColorBrush x:Key="PrimaryColor-Brush" Color="#FFFF9000" />
  <SolidColorBrush x:Key="ButtonBackground-Brush" Color="#FFB4B4B4" />
  <SolidColorBrush x:Key="Header-Brush" Color="#FF5E5E5E" />
  <SolidColorBrush x:Key="Focus-Brush" Color="#FF4B4B4B" />
  <SolidColorBrush x:Key="Border-Brush" Color="#FF9B9B9B" />
  <SolidColorBrush x:Key="Over-Brush" Color="#FFCACACA" />
  <SolidColorBrush x:Key="Background-Brush" Color="#FF7A7A7A" />
  <LinearGradientBrush x:Key="Brush_HeaderBackground" StartPoint="0.5,0" EndPoint="0.5,1">
    <GradientStop Color="#66000088" Offset="0" />
    <GradientStop Color="#BB000088" Offset="1" />
  </LinearGradientBrush>
  <DataTemplate x:Key="EditMaskedCellTemplate">
        <wpfExtended:MaskedTextBox Mask="## /##/ ####" SelectAllOnGotFocus="True" IncludeLiterals="False" IncludePrompt="False"
                               Value="{Binding Path=DateDue, UpdateSourceTrigger=PropertyChanged, 
                               Converter={StaticResource LiteralConverter}}" />
  </DataTemplate>
    <DataTemplate x:Key="ShowMaskCellTemplate">
        <TextBlock Text="{Binding Path=DateDue, Converter={StaticResource MaskConverter}}"/>
    </DataTemplate>
  <Style x:Key="FocusedColumnHeader" TargetType="DataGridColumnHeader">
    <Setter Property="Background">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
          <GradientStop Color="#FFE5E2E0" Offset="0.138" />
          <GradientStop Color="#FFF6792F" Offset="1" />
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>

  </Style>
  <Style x:Key="NonFocusedColumnHeader" TargetType="DataGridColumnHeader">
    <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrush}}" />
  </Style>
  <Style x:Key="FocusedRowHeader" TargetType="DataGridRowHeader">
    <Setter Property="Background">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
          <GradientStop Color="#FFE5E2E0" Offset="0.138" />
          <GradientStop Color="#FFF6792F" Offset="1" />
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>

  </Style>
  <Style x:Key="NonFocusedRowHeader" TargetType="DataGridRowHeader">
    <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrush}}" />
  </Style>

  <DataTemplate x:Key="RegistrationMaskedCell">
    <wpfExtended:MaskedTextBox IncludeLiterals="False" Mask="## /##/ ####"
                               Value="{Binding Path=RegistredAt, Converter={StaticResource DateConverter}}" />
  </DataTemplate>
  <Style TargetType="TextBox">
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="Background" Value="#FFFFFFFF" />
    <Setter Property="Foreground" Value="#FF000000" />
    <Setter Property="Padding" Value="2" />
    <Setter Property="BorderBrush">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FFA3AEB9" Offset="0" />
          <GradientStop Color="#FF8399A9" Offset="0.375" />
          <GradientStop Color="#FF718597" Offset="0.375" />
          <GradientStop Color="#FF617584" Offset="1" />
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
    <Setter Property="Validation.ErrorTemplate">
      <Setter.Value>
        <ControlTemplate>
          <DockPanel LastChildFill="True">
            <Border Background="Red" DockPanel.Dock="Right" Margin="2,0,0,0" Width="20" Height="20" CornerRadius="10"
                    ToolTip="{Binding ElementName=customAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
              <TextBlock Text="!" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold"
                         Foreground="White"></TextBlock>
            </Border>
            <AdornedElementPlaceholder Name="customAdorner" VerticalAlignment="Center">
              <Border BorderBrush="Red" BorderThickness="1" />
            </AdornedElementPlaceholder>
          </DockPanel>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
    <Style TargetType="wpfExtended:MaskedTextBox">
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Background" Value="#FFFFFFFF" />
        <Setter Property="Foreground" Value="#FF000000" />
        <Setter Property="Padding" Value="2" />
        <Setter Property="BorderBrush">
            <Setter.Value>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFA3AEB9" Offset="0" />
                    <GradientStop Color="#FF8399A9" Offset="0.375" />
                    <GradientStop Color="#FF718597" Offset="0.375" />
                    <GradientStop Color="#FF617584" Offset="1" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <DockPanel LastChildFill="True">
                        <Border Background="Red" DockPanel.Dock="Right" Margin="2,0,0,0" Width="20" Height="20" CornerRadius="10"
                    ToolTip="{Binding ElementName=customAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
                            <TextBlock Text="!" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold"
                         Foreground="White"></TextBlock>
                        </Border>
                        <AdornedElementPlaceholder Name="customAdorner" VerticalAlignment="Center">
                            <Border BorderBrush="Red" BorderThickness="1" />
                        </AdornedElementPlaceholder>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <DataTemplate x:Key="SignerData">
    <Border BorderBrush="Silver" BorderThickness="1" CornerRadius="2" Margin="3">
      <Grid FocusManager.FocusedElement="{Binding ElementName=txtSignerId}">
        <Grid.RowDefinitions>
          <RowDefinition />
          <RowDefinition />
          <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" MinWidth="85" />
          <ColumnDefinition Width="0.541*" />
          <ColumnDefinition Width="Auto" MinWidth="85" />
          <ColumnDefinition Width="0.541*" />
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Column="0" Grid.Row="0" Text="{x:Static p:Resources.SignerIdNumberLable}" Margin="0,12,4,2"
                   TextAlignment="Right" VerticalAlignment="Top" />
        <TextBlock Grid.Column="0" Grid.Row="1" Text="{x:Static p:Resources.SignerNameLabel}" Margin="0,12,4,2"
                   TextAlignment="Right" VerticalAlignment="Top" />
        <TextBlock Grid.Column="0" Grid.Row="2" Text="{x:Static p:Resources.SignerIdDateLabel}" Margin="0,12,4,2"
                   TextAlignment="Right" VerticalAlignment="Top" />

        <TextBlock Grid.Column="2" Grid.Row="0" Text="{x:Static p:Resources.SignerMobileLabel}" Margin="0,12,4,2"
                   TextAlignment="Right" VerticalAlignment="Top" />
        <TextBlock Grid.Column="2" Grid.Row="1" Text="{x:Static p:Resources.SignerPhoneLabel}" Margin="0,12,4,2"
                   TextAlignment="Right" VerticalAlignment="Top" />
        <TextBlock Grid.Column="2" Grid.Row="2" Text="{x:Static p:Resources.SignerSecondPhone}" Margin="0,12,4,2"
                   TextAlignment="Right" VerticalAlignment="Top" />

        <TextBox Grid.Column="1" Grid.Row="0" x:Name="txtSignerId"
                 Text="{Binding Path=IdNumber, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" Margin="4,10,5,4"
                 Height="30" MaxLength="10" KeyboardNavigation.TabIndex="0" />
        <TextBox Grid.Column="1" Grid.Row="1"
                 Text="{Binding Path=Name, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" Margin="4,10,5,4"
                 Height="30" TabIndex="1" />
        <wpfExtended:MaskedTextBox Grid.Column="1" Grid.Row="2" IncludeLiterals="False" IncludePrompt="False"
                                   Mask="## /##/ ####"
                                   Value="{Binding Path=IdDate, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource DateConverter}}"
                                   Margin="4,10,5,4" Height="30" TabIndex="2" />

        <TextBox Grid.Column="3" Grid.Row="0" Text="{Binding Path=Mobile, UpdateSourceTrigger=PropertyChanged}"
                 Margin="4,10,5,4" Height="30" MaxLength="10" TabIndex="3" />
        <TextBox Grid.Column="3" Grid.Row="1" Text="{Binding Path=FirstPhone, UpdateSourceTrigger=PropertyChanged}"
                 Margin="4,10,5,4" Height="30" MaxLength="9" TabIndex="4" />
        <TextBox Grid.Column="3" Grid.Row="2" Text="{Binding Path=SecondPhone, UpdateSourceTrigger=PropertyChanged}"
                 Margin="4,10,5,4" Height="30" MaxLength="9" TabIndex="5" />
      </Grid>
    </Border>
  </DataTemplate>

  <DataTemplate x:Key="ContractActivityData">
    <Border BorderBrush="Silver" BorderThickness="1" CornerRadius="2" Margin="3">
      <Grid>
        <Grid.RowDefinitions>
          <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" MinWidth="85" />
          <ColumnDefinition Width="0.541*" />
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Column="0" Grid.Row="0" Text="{x:Static p:Resources.ContractActivityDescLabel}"
                   Margin="0,12,4,2" TextAlignment="Right" VerticalAlignment="Top" />
        <TextBox Grid.Column="1" Grid.Row="0"
                 Text="{Binding Path=Description, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" Margin="4,10,5,4"
                 Height="30" MaxLength="50" />
      </Grid>
    </Border>
  </DataTemplate>
  <Style x:Key="DialogFocusStyle" TargetType="Border">
    <Setter Property="Background">
      <Setter.Value>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
          <GradientStop Color="#FFACC4D6" Offset="0.964" />
          <GradientStop Color="White" Offset="0.023" />
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
  </Style>
    <Style x:Key="DeleteButtonStyle" TargetType="{x:Type Button}" x:Shared="False">
        <Setter Property="Content" Value="{DynamicResource DeleteImage}" />
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Content" Value="{DynamicResource DisabledDeleteImage}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="SaveButtonStyle" TargetType="{x:Type Button}" x:Shared="False">
        <Setter Property="Content" Value="{DynamicResource SaveImage}" />
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Content" Value="{DynamicResource DisabledSaveImage}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="AddButtonStyle" TargetType="{x:Type Button}" x:Shared="False">
        <Setter Property="Content" Value="{DynamicResource AddImage}" />
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Content" Value="{DynamicResource DisabledAddImage}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="AddNewButtonStyle" TargetType="{x:Type Button}" x:Shared="False">
            <Setter Property="Content" Value="{DynamicResource AddNewImage}" />
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Content" Value="{DynamicResource DisabledAddNewImage}" />
                </Trigger>
            </Style.Triggers>
        </Style>
    <Style x:Key="CancelButtonStyle" TargetType="{x:Type Button}" x:Shared="False">
        <Setter Property="Content" Value="{DynamicResource CancelImage}" />
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Content" Value="{DynamicResource DisabledCancelImage}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="DateDueButtonStyle" TargetType="{x:Type Button}" x:Shared="False">
        <Setter Property="Content" Value="{DynamicResource DateDueImage}" />
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Content" Value="{DynamicResource DisabledDateDueImage}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="EditButtonStyle" TargetType="{x:Type Button}" x:Shared="False">
        <Setter Property="Content" Value="{DynamicResource EditImage}" />
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Content" Value="{DynamicResource DisabledEditImage}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="FindButtonStyle" TargetType="{x:Type Button}" x:Shared="False">
        <Setter Property="Content" Value="{DynamicResource FindImage}" />
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Content" Value="{DynamicResource DisabledFindImage}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="OkButtonStyle" TargetType="{x:Type Button}" x:Shared="False">
        <Setter Property="Content" Value="{DynamicResource OkImage}" />
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Content" Value="{DynamicResource DisabledOkImage}" />
            </Trigger>
        </Style.Triggers>
        
    </Style>
    <Style x:Key="PrintButtonStyle" TargetType="{x:Type Button}" x:Shared="False">
        <Setter Property="Content" Value="{DynamicResource PrintImage}" />
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Content" Value="{DynamicResource DisabledPrintImage}" />
            </Trigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="ShowHideButtonStyle" TargetType="{x:Type Button}" x:Shared="False">
            <Setter Property="Content" Value="{DynamicResource ShowHideImage}" />
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Content" Value="{DynamicResource DisabledShowHideImage}" />
                </Trigger>
            </Style.Triggers>
        </Style>
    <Style x:Key="RefreshButtonStyle" TargetType="{x:Type Button}" x:Shared="False">
        <Setter Property="Content" Value="{DynamicResource RefreshImage}" />
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Content" Value="{DynamicResource DisabledRefreshImage}" />
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>